package com.joke.mydiary.pickers;


import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;

import com.joke.mydiary.RemindManagerActivity;

import java.util.Calendar;

/**
 * 设置日期的选择器
 * Created by Administrator on 2015/12/2.
 */
public class DatePickerFragment extends DialogFragment {

    private RemindManagerActivity ra;

    public static DatePickerFragment getDatePickerFragment(RemindManagerActivity ra) {
        DatePickerFragment dpf=new DatePickerFragment();
        Bundle bundle=new Bundle();
        bundle.putSerializable("remindActivity", ra);
        dpf.setArguments(bundle);
        return dpf;
    }


    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final Calendar c = Calendar.getInstance();
        int year = c.get(Calendar.YEAR);
        int month = c.get(Calendar.MONTH);
        int day = c.get(Calendar.DAY_OF_MONTH);
        // Create a new instance of DatePickerDialog and return it
        ra= (RemindManagerActivity) this.getArguments().getSerializable("remindActivity");
        return new DatePickerDialog(getActivity(), ra, year, month, day);

    }


}
